package com.zhida.jiyangcenter.api

import chooongg.base.manager.app
import chooongg.http.HttpManager
import com.vehicle.inspection.api.BaseTokenInterceptor
import com.zhida.jiyangcenter.DEFAULT_ROW
import com.zhida.jiyangcenter.utils.SP
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.http.Field
import retrofit2.http.FormUrlEncoded
import retrofit2.http.POST

interface APIShop {
    companion object {
        fun service() =
            HttpManager.create(app.applicationContext, "http://beauty.hebzd.com/api/shop/") {
                addConverterFactory(GsonConverterFactory.create())
                addInterceptor("shop", BaseTokenInterceptor())
            }.getAPI(APIShop::class.java)
    }

    /**
     *商品列表
     */
    @POST("product/list")
    @FormUrlEncoded
    suspend fun productList(
        @Field("classify") classify: String,
        @Field("search") search: String? = null,
        @Field("pageSize") pageSize: Int = DEFAULT_ROW,
        @Field("pageNumber") pageNumber: Int
    ): NetResponse<ProductListEntity>

    /**
     *电子档案列表
     */
    @POST("e_record/list")
    @FormUrlEncoded
    suspend fun e_recordList(
        @Field("PageNumber") PageNumber: Int,
        @Field("PageSize") PageSize: Int = DEFAULT_ROW
    ): NetResponse<List<ErecordListEntity>>

    /**
     *商品详情
     */
    @POST("product/info")
    @FormUrlEncoded
    suspend fun productInfo(
        @Field("parm") classify: String
    ): NetResponse<ShopInfoEntity>

    /**
     *添加购物车
     */
    @POST("shopcar/add")
    @FormUrlEncoded
    suspend fun shopcarAdd(
        @Field("parm") classify: String,
        @Field("num") num: Int,
        @Field("key_id") key_id: String = SP.key_id.get().toString(),
        @Field("login_account") login_account: String = SP.account.get().toString()
    ): NetResponse<Any>

    /**
     *添加购物车(服务)
     */
    @POST("shopcar/serve/add")
    @FormUrlEncoded
    suspend fun shopcarServeAdd(
        @Field("parm") classify: String,
        @Field("num") num: Int,
        @Field("key_id") key_id: String = SP.key_id.get().toString(),
        @Field("login_account") login_account: String = SP.account.get().toString()
    ): NetResponse<Any>

    /**
     *购物车数量修改
     */
    @POST("shopcar/num/edit")
    @FormUrlEncoded
    suspend fun shopcarNumEdit(
        @Field("parm") classify: String,
        @Field("num") num: Int,
        @Field("key_id") key_id: String = SP.key_id.get().toString(),
        @Field("login_account") login_account: String = SP.account.get().toString()
    ): NetResponse<Any>

    /**
     *购物车数量修改(服务)
     */
    @POST("shopcar/serve/edit")
    @FormUrlEncoded
    suspend fun shopcarServeEdit(
        @Field("parm") classify: String,
        @Field("num") num: Int,
        @Field("key_id") key_id: String = SP.key_id.get().toString(),
        @Field("login_account") login_account: String = SP.account.get().toString()
    ): NetResponse<Any>

    /**
     *购物车列表
     */
    @POST("shopcar/list")
    @FormUrlEncoded
    suspend fun shopcarList(
        @Field("key_id") key_id: String = SP.key_id.get().toString(),
        @Field("login_account") login_account: String = SP.account.get().toString()
    ): NetResponse<ShopCarListEntity>

    /**
     *购物车列表(服务)
     */
    @POST("shopcar/serve/list")
    @FormUrlEncoded
    suspend fun shopcarServeList(
        @Field("key_id") key_id: String = SP.key_id.get().toString(),
        @Field("login_account") login_account: String = SP.account.get().toString()
    ): NetResponse<ShopCarStoreListEntity>

    /**
     *购物车删除
     */
    @POST("shopcar/del")
    @FormUrlEncoded
    suspend fun shopcarDel(
        @Field("parm") classify: String,
        @Field("key_id") key_id: String = SP.key_id.get().toString(),
        @Field("login_account") login_account: String = SP.account.get().toString()
    ): NetResponse<Any>

    /**
     *购物车删除(服务)
     */
    @POST("shopcar/serve/del")
    @FormUrlEncoded
    suspend fun shopcarServeDel(
        @Field("parm") classify: String,
        @Field("key_id") key_id: String = SP.key_id.get().toString(),
        @Field("login_account") login_account: String = SP.account.get().toString()
    ): NetResponse<Any>

    /**
     *门店首页（健康驿站页）
     */
    @POST("store/list")
    @FormUrlEncoded
    suspend fun storeList(
        @Field("city") city: String,
        @Field("longitude") longitude: Double,
        @Field("latitude") latitude: Double,
        @Field("PageNumber") PageNumber: Int,
        @Field("form") form: String,
        @Field("search") search: String,
        @Field("PageSize") PageSize: Int = DEFAULT_ROW
    ): NetResponse<StoreListEntity>

    /**
     *健康体检页（列表）
     */
    @POST("store/examination/list")
    @FormUrlEncoded
    suspend fun storeExaminationList(
        @Field("parm") parm: String,
        @Field("longitude") longitude: Double,
        @Field("latitude") latitude: Double,
        @Field("PageNumber") PageNumber: Int,
        @Field("search") search: String,
        @Field("PageSize") PageSize: Int = DEFAULT_ROW
    ): NetResponse<StoreExaminationListEntity>

    /**
     *健康驿站服务（列表）
     */
    @POST("store/health/list")
    @FormUrlEncoded
    suspend fun storeHealthList(
        @Field("parm") parm: String,
        @Field("longitude") longitude: Double,
        @Field("latitude") latitude: Double,
        @Field("PageNumber") PageNumber: Int,
        @Field("search") search: String,
        @Field("PageSize") PageSize: Int = DEFAULT_ROW
    ): NetResponse<StoreExaminationListEntity>

    /**
     *体检详情
     */
    @POST("store/examination/info")
    @FormUrlEncoded
    suspend fun storeExaminationInfo(
        @Field("parm") parm: String,
        @Field("city") city: String,
        @Field("key_id") key_id: String = SP.key_id.get().toString(),
        @Field("login_account") login_account: String = SP.account.get().toString()
    ): NetResponse<StoreExaminationInfoEntity>

    /**
     *商品下单页
     */
    @POST("product/order")
    @FormUrlEncoded
    suspend fun productOrder(
        @Field("parm") parm: String,
        @Field("key_id") key_id: String = SP.key_id.get().toString(),
        @Field("login_account") login_account: String = SP.account.get().toString()
    ): NetResponse<ProductOrderEntity>

    /**
     *商品评价
     */
    @POST("product/comment/list")
    @FormUrlEncoded
    suspend fun productCommentList(
        @Field("parm") parm: String,
        @Field("pageNumber") pageNumber: Int,
        @Field("pageSize") pageSize: Int = DEFAULT_ROW,
        @Field("key_id") key_id: String = SP.key_id.get().toString(),
        @Field("login_account") login_account: String = SP.account.get().toString()
    ): NetResponse<CommentList>

    /**
     *服务评价
     */
    @POST("serve/comment/list")
    @FormUrlEncoded
    suspend fun serveCommentList(
        @Field("parm") parm: String,
        @Field("pageNumber") pageNumber: Int,
        @Field("pageSize") pageSize: Int = DEFAULT_ROW,
        @Field("key_id") key_id: String = SP.key_id.get().toString(),
        @Field("login_account") login_account: String = SP.account.get().toString()
    ): NetResponse<CommentList>

    /**
     *服务下单页
     */
    @POST("serve/order")
    @FormUrlEncoded
    suspend fun serveOrder(
        @Field("serve_uuid") parm: String,
        @Field("key_id") key_id: String = SP.key_id.get().toString(),
        @Field("login_account") login_account: String = SP.account.get().toString()
    ): NetResponse<ProductOrderEntity>

    /**
     *商品下单页(购物车)
     */
    @POST("product/car/order")
    @FormUrlEncoded
    suspend fun productCarOrder(
        @Field("parm") parm: String,
        @Field("key_id") key_id: String = SP.key_id.get().toString(),
        @Field("login_account") login_account: String = SP.account.get().toString()
    ): NetResponse<ProductOrderEntity>

    /**
     *商品下单
     */
    @POST("product/order/submit")
    @FormUrlEncoded
    suspend fun productOrderSubmit(
        @Field("product_uuid") product_uuid: String,
        @Field("address_uuid") address_uuid: String,
        @Field("coupon_uuid") coupon_uuid: String,
        @Field("num") num: Int,
        @Field("money") money: Double,
        @Field("key_id") key_id: String = SP.key_id.get().toString(),
        @Field("login_account") login_account: String = SP.account.get().toString()
    ): NetResponse<ProductOrderSubmitEntity>

    /**
     *服务下单
     */
    @POST("serve/order/submit")
    @FormUrlEncoded
    suspend fun serveOrderSubmit(
        @Field("serve_uuid") serve_uuid: String,
        @Field("money") money: Double,
        @Field("coupon_uuid") coupon_uuid: String,
        @Field("key_id") key_id: String = SP.key_id.get().toString(),
        @Field("login_account") login_account: String = SP.account.get().toString()
    ): NetResponse<ProductOrderSubmitEntity>

    /**
     *针对于购物车的优惠券列表
     */
    @POST("product/coupon/list")
    @FormUrlEncoded
    suspend fun productCouponList(
        @Field("product_uuid") product_uuid: String,
        @Field("num") num: Int,
        @Field("key_id") key_id: String = SP.key_id.get().toString(),
        @Field("login_account") login_account: String = SP.account.get().toString()
    ): NetResponse<List<ProductOrderEntity.CouponList>>

    /**
     *商品下单(购物车)
     */
    @POST("product/order/car/submit")
    @FormUrlEncoded
    suspend fun productOrderCarSubmit(
        @Field("dict1") dict1: String,
        @Field("key_id") key_id: String = SP.key_id.get().toString(),
        @Field("login_account") login_account: String = SP.account.get().toString()
    ): NetResponse<ProductOrderSubmitEntity>

}